package com.hdy.web.dao;

import com.hdy.web.pojo.Reply;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ReplyMapper {
    @Select("select * from comments_reply where to_id=#{toId};")
    List<Reply> getByToId(@Param("toId") String toId)throws Exception;
    @Select("select * from comments_reply where mid=#{mid};")
    List<Reply> getById(@Param("mid") int mid)throws Exception;
    @Insert("insert into comments_reply (mid,from_id,to_id,p_content,content)VALUES " +
            "(#{mid}, #{fromId}, #{toId},#{pContent},#{content} ) ")
    @Options(useGeneratedKeys=true,keyProperty="entity.rid",keyColumn = "rid")
    int insertReply(@Param("mid") int mid, @Param("fromId") String fromId,@Param("toId") String toId,
                      @Param("content") String content,@Param("pContent") String pContent,@Param("entity") Reply entity);
}
